<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<title></title>
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<link rel="stylesheet" type="text/css" href="../css/me.css" />
		<!--bootstrap插件-->
		<script src="../js/jquery-3.1.1.min.js"></script>
		<link rel="stylesheet" type="text/css" href="../bootstrap1/css/bootstrap.min.css" />
		<script src="../bootstrap1/js/bootstrap.min.js" type="text/javascript" charset="utf-8"></script>
		<!--省市联动插件-->
		<script src="../js/jquery-1.9.1.js"></script>
		<script src="../js/area.js"></script>
		<script src="../js/zishiying.js"></script>
		<link rel="stylesheet" href="../js/area.css" />
		<style type="text/css">
			* {
				margin: 0;
				padding: 0;
				list-style: none;
				
			}
			
			html,
			body {
				width: 100%;
				overflow: hidden;
			}
			
			.top_a {
				width: 100%;
				display: flex;
				margin-bottom: 0;
				padding: 0.8rem 0;
				background: white;
				border-bottom: 1px solid #EEEEEE;
			}
			
			.top_a li {
				text-align: center;
				font-size: 20px;
			}
			
			.qing {
				width: 100%;
				background: white;
				flex-wrap: wrap;
				margin-bottom: 0;
			}
			
			.qing li {
				width: 100%;
				padding: 1rem 1rem;
				border-bottom: 1px solid #EEEEEE;
				
			}
			.qing li input{
				border: 0;
				outline: none;
			}
			
			.btn {
				width: 100%;
				padding: 0.8rem 0;
				border-radius: 5px;
				background: #FF5000;
				color: white;
			}
			.dqld_div{
				position: absolute;
				top: 86px;
				left: 0;
				z-index: 100;
			}
			.dqld_div ul{
				width: 100%;
			}
		</style>
	</head>

	<body>
		<ul class="top_a">
			<li style="width: 10%;">
				<a href="me.html"><div class="glyphicon glyphicon-menu-left"></div></a>
			</li>
			<li style="width: 80%;">
				管理收货地址
			</li>
			<li style="width: 10%;">

			</li>
		</ul>
		<ul class="qing">
			<li style="border-bottom: 1px solid #EEEEEE;">
				<div id="addAddress">
					<div class="address_input"><input class="address_input1" type="text" placeholder="请选择城市" id="shengshi" onClick="getProvinceBuy()" readonly="readonly"></div>
				</div>
			</li>
			<li>
				<input type="text" placeholder="请输入详细地址" id="addr" class="addr"/>
			</li>
			<li>
				<input type="text" placeholder="请输入收货人姓名" id="name" class="name" />
			</li>
			<li>
				<input type="text" placeholder="请输入收货人联系电话" id="pho" class="pho" />
			</li>
			<li>
				<input type="text" placeholder="请输入邮箱" id="ema" class="ema"/>
			</li>

		</ul>
		<div class="btn navbar-fixed-bottom">
			保存地址
		</div>
	</body>
	<script type="text/javascript">
		var user_phone=localStorage.getItem(user_phone);
		$('.btn').click(function() {
			
			//获取省市的value值
			var shengshi = $(".address_input1").val();
			console.log(shengshi);

			var phone=$(".pho").val();
			console.log(phone)//
			
			var addr=$(".addr").val();
			console.log(addr);
			
			var name=$(".name").val();
			console.log(name)
			
			var ema=$(".ema").val();
			console.log(ema);
			
			//完整地址
			var dizhi = shengshi + addr+name+phone;
			console.log(dizhi);
			
			
			$.ajax({
				type: 'post',
				url: "http://47.92.37.168/supermarket/data/user_update_addr.php",
				async: true,
				data: {
					user_addr:dizhi,
					user_phone: user_phone
				},
				dataType: "jsonp",
				jsonp: "callback",
				success: function(data) {
					console.log(data)
					
					if(data.msg = 'success'){
						
						localStorage.setItem("user_addr",dizhi);						
//						localStorage.setItem('name',name);
//						localStorage.setItem('phone',phone);
//						localStorage.setItem('ema',ema);
//						window.location.href = "新增1.html";

						
						
					}
				}
			})
		})
	</script>
</html>